/********************************************
 *      
 * Created by zlj on 2024/9/10.
********************************************/

#ifndef DATA_STRUCTURE_KALMAN_H
#define DATA_STRUCTURE_KALMAN_H
//定义卡尔曼滤波器结构体
typedef struct {
    float x;    // 状态估计值
    float P;    // 误差协方差
    float Q;    // 过程噪声协方差
    float R;    // 测量噪声协方差
    float K;    // 卡尔曼增益
} KalmanFilter;

void kalman_init(KalmanFilter *kf, float process_noise, float measurement_noise,
                 float estimate_error, float initial_value);

float kalman_update(KalmanFilter *kf, float measurement);

#endif //DATA_STRUCTURE_KALMAN_H
